package drymouth;
public class ConditionScore implements Comparable
{
	//private data
	private Condition myCondition;
	private double myScore;
	
	//constructors
	public ConditionScore()
	{ConditionScore(new Condition(),0);}
	
	public ConditionScore(Condition c, double score)
	{myCondition=c; myScore=score;}
	
	//accessors
	public double getScore()
	{return myScore;}
	
	public double getCondition()
	{return myCondition;}
	
	//comparability
	public int compareTo(Object o)
	{	
		
		if (!((o.getClass().getName()).equals("ConditionScore")))
		{
			throw new Exception("Cannot compare non-ConditionScores using ConditionScore compareTo()"); // checks for correct class comparison
			return -2;
		}
		ConditionScore cs=(ConditionScore) o;
		overallScore=cs.getScore()-myScore;
		if (overallScore >0)
			return 1;
		if (overallScore ==0)
			return 0;
		else
			return -1;
	//changed to reflect that if we hare better we will have a lower score now
	}

}